<div class="content-titulo">
    <h2><?php echo $this->titulo;?></h2>
</div>

<div class="content-form">

    <form method="post" action="" enctype="application/x-www-form-urlencoded">
        <input type="hidden" id="EMP_ID" name="EMP_ID" value="<?php echo $this->data['EMP_ID']?>" />
    <div class="col">
        <div class="cnt-foto" style="height: 171px;">
    <?php $imgs_pri = glob('public/upload/empresa/'.$this->data['EMP_ID'].'.*');
    if(isset($imgs_pri[0])){
    ?> 
            <img class="fot_pr" src="<?php echo $this->urlbase.'/'.$imgs_pri[0].'?'.rand(100, 999); ?>" />
    <?php } ?>
        </div>  
        <div style="margin: 10px 0px; text-align: center;">
            <span class="btn btn-success fileinput-button">
                <span>carregar fotos</span>
                <input id="fileupload" type="file" name="files[]" multiple>
            </span>
            <span class="btn btn-default ex-ft">
                <span>excluir foto</span>
            </span>
            <div id="progress" class="progress" style="margin-top: 10px">
                <div class="progress-bar progress-bar-success"></div>
            </div>
        </div>
        
        <dt><label>Nome da Escola/Empresa </label></dt> <dd><input type="text" name="EMP_NOM" value="<?php echo $this->data['EMP_NOM']?>" /></dd>
        <dt><label>Segmento</label></dt> <dd> <?php echo elemform::select('CTS_ID', 'CTS_NOM', $this->data['CTS_ID'],'CTS_STA'); ?> </dd> 
        
        
    </div>
    
    <div class="col">
        <dt><label>Endereço: </label></dt> <dd><input type="text" name="EMP_END" value="<?php echo $this->data['EMP_END']?>" /></dd>
        <dt><label>Bairro: </label></dt> <dd><input type="text" name="EMP_BAI" value="<?php echo $this->data['EMP_BAI']?>" /></dd>
        <dt><label>CEP: </label></dt> <dd><input type="text" name="EMP_CEP" value="<?php echo $this->data['EMP_CEP']?>" /></dd>
        <dt><label>Cidade: </label></dt> <dd><input type="text" name="EMP_CID" value="<?php echo $this->data['EMP_CID']?>" /></dd>
        <dt><label>Telefone: </label></dt> <dd><input type="text" name="EMP_TEL" value="<?php echo $this->data['EMP_TEL']?>" /></dd>
        <dt><label>E-mail: </label></dt> <dd><input type="text" name="EMP_EML" value="<?php echo $this->data['EMP_EML']?>" /></dd>
        <dt><label>Status</label></dt> <dd><?php echo elemform::checkbox('EMP_STA', '1', $this->data['EMP_STA']); ?> Ativo</dd>
        
        <input type="submit" class="btn-button btn-ok" value="Cadastrar" id="submitbutton">
        <a class="btn-button btn-cancel" href="<?php echo $this->baseUrl($this->modulo.'/'.$this->controller); ?>">Cancelar</a>
        
    </div>
        
    <div class="col">
        
    </div>   
    
    </form>
</div>
<script>
$(document).ready(function() {   
    dataPicker($('.data'));
});
</script>
<script src="<?php echo $this->urlbase;?>/public/media/js/jquery.jcarousel.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {   
    $('.slider').jcarousel({ auto: 4 });
});
</script>

<link rel="stylesheet" href="<?php echo $this->urlbase.'/public/media/js/multiupload/css/bootstrap.min.css'; ?>">
<link rel="stylesheet" href="<?php echo $this->urlbase.'/public/media/js/multiupload/css/font-awesome.css'; ?>">
<link rel="stylesheet" href="<?php echo $this->urlbase.'/public/media/js/multiupload/css/jquery.fileupload-ui.css'; ?>" />

<script src="<?php echo $this->urlbase.'/public/media/js/multiupload/'; ?>js/vendor/jquery.ui.widget.js"></script>
<script src="<?php echo $this->urlbase.'/public/media/js/multiupload/'; ?>js/jquery.iframe-transport.js"></script>
<script src="<?php echo $this->urlbase.'/public/media/js/multiupload/'; ?>js/jquery.fileupload.js"></script>
<script>
$(function () {
    'use strict';
    // Change this to the location of your server-side upload handler:
    var url = '<?php echo $this->urlbase.'/public/media/js/multiupload/server/php/'; ?>';
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo('#files');
            });
        },
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .progress-bar').css(
                'width',
                progress + '%'
            );
            if(progress == 100)  if(confirm('Gostaria de atualizar a foto?')){ window.location.reload(); }
            
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
});
</script>

<script>
$(document).ready(function() {   
    $('.img').click(function(){
        if($(this).attr('select') == '1'){
            $(this).removeClass('select').removeAttr('select');
        }else{
            $('.img').removeClass('select').removeAttr('select');
            
            $(this).addClass('select').attr('select','1');
            $('.fot_pr').attr('src',$(this).attr('src').replace('_tb','_hl'));
        }
    });
    
    $('.ex-ft').click(function(){
        if(confirm('Deseja excluir a foto?'))        
            $.get(URLBASE+'/'+CONTROL+'/delfoto', { id:$('#EMP_ID').val() }, function(data){                  
                if(data.ok)
                {  
                    window.location.reload();
                }   
            }, 'json');
    });
    
   
});
</script>